var strCookie = document.cookie;
//将多cookie切割为多个名/值对
var arrCookie = strCookie.split("; ");
var userid; //userid
var realname; //真实姓名
var departmentid; //部门
var userno; //用户编号
var roleid; //角色
var rolename; //角色名称
var departmentname; //部门名称
var productcategoryid; //产品类别
//遍历cookie数组，处理每个cookie对
//从cookie中获取userid
//$.messager.alert('警告',strCookie);
for (var i = 0; i < arrCookie.length; i++)
{
    var arr = arrCookie[i].split("=");
    //找到名称为userId的cookie，并返回它的值
    if ("userid" == arr[0])
    {
        userid = arr[1];
        break;
    }
}
//从cookie中获取userid
for (var i = 0; i < arrCookie.length; i++)
{
    var arr = arrCookie[i].split("=");
    //找到名称为userId的cookie，并返回它的值
    if ("realname" == arr[0])
    {
        realname = arr[1];
        break;
    }
}
//从cookie中获取departmentid
for (var i = 0; i < arrCookie.length; i++)
{
    var arr = arrCookie[i].split("=");
    //找到名称为userId的cookie，并返回它的值
    if ("departmentid" == arr[0])
    {
        departmentid = arr[1];
        break;
    }
}
//从cookie中获取userno
for (var i = 0; i < arrCookie.length; i++)
{
    var arr = arrCookie[i].split("=");
    //找到名称为userId的cookie，并返回它的值
    if ("userno" == arr[0])
    {
        userno = arr[1];
        break;
    }
}
//从cookie中获取roleid
for (var i = 0; i < arrCookie.length; i++)
{
    var arr = arrCookie[i].split("=");
    //找到名称为userId的cookie，并返回它的值
    if ("roleid" == arr[0])
    {
        roleid = arr[1];
        break;
    }
}
//从cookie中获取rolename
for (var i = 0; i < arrCookie.length; i++)
{
    var arr = arrCookie[i].split("=");
    //找到名称为userId的cookie，并返回它的值
    if ("rolename" == arr[0])
    {
        rolename = arr[1];
        break;
    }
}
//从cookie中获取departmentname
for (var i = 0; i < arrCookie.length; i++)
{
    var arr = arrCookie[i].split("=");
    //找到名称为userId的cookie，并返回它的值
    if ("departmentname" == arr[0])
    {
        departmentname = arr[1];
        break;
    }
}
//从cookie中获取productcategoryid
for (var i = 0; i < arrCookie.length; i++)
{
    var arr = arrCookie[i].split("=");
    //找到名称为userId的cookie，并返回它的值
    if ("productcategoryid" == arr[0])
    {
        productcategoryid = arr[1];
        break;
    }
}

//页面权限分配
var authority = "";
for (var i = 0; i < arrCookie.length; i++)
{
    var arr = arrCookie[i].split("=");
    //找到名称为userId的cookie，并返回它的值
    if ("pageauthority" == arr[0])
    {
        pageauthority = arr[1];
        break;
    }
}
var arr1 = pageauthority.split('|');
for (var i = 0; i < arr1.length; i++)
{
    var arr2 = arr1[i].split(':');
    if ("10000" == arr2[0])
    {
        authority = arr2[1];
        break;
    }
}
var authorityString = authority.toString();
